/**
 * @author baz
 */
package bot.state {
import bot.*;

import flash.geom.Point;

public class BotStateCircle implements IBotState {
    private static const SPEED:int = 3;
    private static const RADIUS:int = 150;

    private var view:BotView;
    private var angle:int;

    private var center:Point;

    public function BotStateCircle(botModel:BotView) {
        view = botModel;
    }

    public function init(...params):void {
        center = params[0];
        angle = params[1];

        view.x += center.x;
        view.y += center.y;

        move();
    }

    public function frameHandler():void {
        angle += SPEED;
        move();
    }

    public function cleanup():void {
    }

    private function move():void {
        var radian:Number = angle * Math.PI / 180;
        view.x = Math.cos(radian) * RADIUS + center.x;
        view.y = Math.sin(radian) * RADIUS + center.y;
        trace(">>>", view.x);
    }

    public function cleanUp():void {
    }
}
}
